package com.RPGDice.util;

import com.criticalritrpg.R;

public class RollableDice {
	
	String diceName;
	int[] rollValues;
	int rollResult;
	int numberOfRolls;
	int resultCount = 0;
	String color;
	
	public RollableDice(String diceName, int numberOfRolls, String color) {
		this.diceName = diceName;
		this.numberOfRolls = numberOfRolls;
		this.color = color;
		this.rollValues = new int[numberOfRolls];
		this.resultCount = 0;
	}
	
	public void calculateResult(){
		this.rollResult = 0;
		for (int i = 0; i < rollValues.length; i++)
			this.rollResult += rollValues[i];
	}
	
	public int getNumberOfRolls(){
		return numberOfRolls;
	}
	
	public void addRollValue(int rollValue){
		rollValues[resultCount] = rollValue;
		resultCount ++;
	}
	
	public String getColor(){
		return color;
	}

	public String getDiceName() {
		return diceName;
	}

	public void setDiceName(String diceName) {
		this.diceName = diceName;
	}

	public int[] getRollValues() {
		return rollValues;
	}

	public void setRollValues(int[] rollValues) {
		this.rollValues = rollValues;
	}

	public int getRollResult() {
		calculateResult();
		return rollResult;
	}

	public void setRollResult(int rollResult) {
		this.rollResult = rollResult;
	}

}
